import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'home',
    meta:{
      index:2
    },
    component: HomeView,
    children: [
      {
        path: '/user/list',
        meta: {
          index: 1
        },
        component: () => import('../views/user/UserListView.vue')
      },
      {
        path: '/user/upgrade',
        component: () => import('../views/user/UserUpgradeView.vue')
      },
      {
        path: '/user/home',
        component: () => import('../views/HomeView.vue')
      },
      {
        path: '/shopping/goods',
        component: () => import('../views/shopping/Goods.vue')
      },
      {
        path: '/shopping/product',
        component: () => import('../views/shopping/Product.vue')
      }
    ]
  },
  {
    path: '/login',
    component: () => import('../views/LoginView.vue')
  },
  {
    path: '/reg',
    component: () => import('../views/RegView.vue')
  },
  {
    path: '/index',
    component: () => import('../views/IndexView.vue')
  },
  {
    path: '/echarts',
    component: () => import('../views/Echartsb.vue')
  }
  // {
  //    path: '/shop',
  //    component: () => import('../views/ShoppingView.vue')
  // }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
